<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <input type="text" name="name" class="search">
  <button class="submit">提交</button>

  <ul class="content">
    <li></li>
  </ul>

  <script>
    const s1802B = ['李祥', '姜雨馨', '尹腾', '朱贺成', '肖文轩', '常丰正']
    const submitBtn = document.querySelector('.submit')
    const search = document.querySelector('.search')
    const content = document.querySelector('.content')
    // 箭头函数共享父级作用域
    submitBtn.onclick = function () {
      content.innerHTML = s1802B.map(item => {
        // includes的字符串方法
        if (item.includes(search.value)) {
          return item;
        }
      }).join('')
    }



  </script>
</body>

</html>